package com.kuson.springcloud.controller;

import com.kuson.springcloud.entities.CommonResult;
import com.kuson.springcloud.entities.Payment;
import com.kuson.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
public class FeignOrderController {
    @Resource
    private PaymentFeignService paymentFeignService;

    /**
     * 调用服务提供者的接口
     *
     * @param id
     * @return
     */
    @GetMapping("/consumer/payment/get/{id}")
    public CommonResult<Payment> getPaymentBid(@PathVariable Long id) {
        log.info("***我是通过Feing调用实现的微服务方法***");
        return paymentFeignService.getPaymentBid(id);
    }

    /**
     * 调用时间长的业务方法
     *
     */
    @GetMapping("/consumer/payment/feign/timeout")
    public String timeOUt(){
        return paymentFeignService.timeOut();
    }
}
